import type {
  SysTenantPackageDtlVo,
  SysTenantPackagePageQo,
  SysTenantPackageQo,
  SysTenantPackageVo,
} from '#/system/tenants/tenantsPackage'
import { http } from '@/utils/request/index'

/**
 * 获取租户套餐分页列表
 * @param params 查询参数
 * @returns 租户套餐列表
 */
export function getSysTenantPackagePageListApi(params: SysTenantPackagePageQo) {
  return http.request<PageResult<SysTenantPackageVo>>('get', '/admin-api/system/sysTenantPackage/sysTenantPackagePage', {
    params,
  })
}

/**
 * 获取租户套餐列表
 * @param params 查询参数
 * @returns 租户套餐列表
 */
export function getSysTenantPackageListApi(params: SysTenantPackagePageQo) {
  return http.request<SysTenantPackageVo[]>('get', '/admin-api/system/sysTenantPackage/sysTenantPackageList', {
    params,
  })
}

/**
 * 获取租户套餐详情
 * @param id 租户套餐id
 * @returns 租户套餐详情
 */
export function getSysTenantPackageDetailsApi(id?: string) {
  return http.request<SysTenantPackageDtlVo>('get', `/admin-api/system/sysTenantPackage/sysTenantPackageDetails/${id}`)
}

/**
 * 新增租户套餐
 * @param data 租户套餐信息
 * @returns 租户套餐id
 */
export function createSysTenantPackageApi(data: SysTenantPackageQo) {
  return http.request<string>('post', '/admin-api/system/sysTenantPackage/sysTenantPackageCreate', {
    data,
  })
}

/**
 * 修改租户套餐
 * @param data 租户套餐信息
 * @returns 租户套餐id
 */
export function updateSysTenantPackageApi(data: SysTenantPackageQo) {
  return http.request<string>('post', '/admin-api/system/sysTenantPackage/sysTenantPackageUpdate', {
    data,
  })
}

/**
 * 删除租户套餐
 * @param idList 租户套餐id列表
 * @returns 租户套餐id
 */
export function deleteSysTenantPackageApi(idList: string[]) {
  return http.request<string>('post', '/admin-api/system/sysTenantPackage/sysTenantPackageRemove', {
    params: {
      idList: idList.join(','),
    },
  })
}

/**
 * 启用租户套餐
 * @param idList 租户套餐id列表
 * @returns 租户套餐id
 */
export function enableSysTenantPackageApi(idList: string[]) {
  return http.request<string>('post', '/admin-api/system/sysTenantPackage/sysTenantPackageEnable', {
    params: {
      idList: idList.join(','),
    },
  })
}

/**
 * 禁用租户套餐
 * @param idList 租户套餐id列表
 * @returns 租户套餐id
 */
export function disableSysTenantPackageApi(idList: string[]) {
  return http.request<string>('post', '/admin-api/system/sysTenantPackage/sysTenantPackageDisable', {
    params: {
      idList: idList.join(','),
    },
  })
}
